<script lang="ts" setup></script>

<template>
  <div class="my-info-container">
    <div class="form">
      <div class="form-left-entry">
        <div class="input-box">
          <div class="label">昵称</div>
          <div class="input">
            <input class="text" type="text" placeholder="请输入昵称" />
          </div>
        </div>
        <div class="input-box">
          <div class="label">性别</div>
          <div class="input">
            <span>男</span><input type="radio" value="1" name="sex" checked />
            &nbsp;
            <span>女</span><input type="radio" value="0" name="sex" />
            &nbsp;
            <span>保密</span><input type="radio" value="2" name="sex" />
          </div>
        </div>
        <!-- <div class="input-box">
        <div class="label">年龄</div>
        <div class="input">
          <input type="text" placeholder="请输入年龄" />
        </div>
      </div> -->
      </div>
      <div class="form-right-entry">
        <dl>
          <dt class="label">更换头像</dt>
          <dd>
            <div class="filebtn">
              <label for="avatar">选择文件</label>
              <input id="avatar" name="avatar" type="file" />
            </div>
          </dd>
        </dl>
        <dl>
          <dt class="label">当前头像</dt>
          <dd class="avatar">
            <img src="/src/assets/pre.jpg" alt="" />
          </dd>
        </dl>
      </div>
    </div>
    <div class="operation">
      <button class="savebtn">保存</button>
    </div>
  </div>
</template>

<style lang="less" scoped>
.my-info-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.form {
  width: 100%;
  display: flex;
  justify-content: space-between;
  .form-left-entry {
    width: 50%;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .form-right-entry {
    width: 50%;
    padding: 5px;
    dl {
      display: flex;
      align-items: center;
      &:not(:last-child) {
        margin-bottom: 20px;
      }
    }
    .label {
      display: block;
      margin-right: 10px;
      height: 30px;
      line-height: 30px;
    }
    .avatar {
      width: 100px;
      height: 100px;
      border-radius: 10px;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .filebtn {
      width: 100px;
      height: 30px;
      background-color: #fff;
      border: none;
      border-radius: 5px;
      color: #000;
      font-size: 14px;
      line-height: 30px;
      text-align: center;
      cursor: pointer;
    }
    input[type='file'] {
      width: 100px;
      height: 100%;
      left: 0;
      top: 0;
      opacity: 0;
      outline: none;
    }
    label {
      display: inline-block;
      background: #ff5000;
      border: none;
      width: 100px;
      height: 30px;
      line-height: 30px;
      font-size: 12px;
      color: #fff;
      border-radius: 5px;
      cursor: pointer;
    }
  }
  .input-box {
    width: 100%;
    height: 30px;
    display: flex;
    &:not(:last-child) {
      /* margin-bottom: 40px; */
    }
    .label {
      width: 12%;
      height: 100%;
      display: flex;
      align-items: center;
      margin-right: 10px;
    }
    .input {
      flex: 1;
      height: 30px;
      display: flex;
      align-items: center;
      span {
        display: inline-block;
        line-height: 30px;
      }
    }
    input {
      height: 100%;
      outline: none;
      box-sizing: border-box;
      border-radius: 5px;
      border: 1px solid #e9e9e9;
      padding: 0 5px;
      &.text {
        width: 100%;
      }
    }
    input[type='radio'] {
      margin: 0 5px;
      line-height: 30px;
    }
  }
}
.operation {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .savebtn {
    width: 100px;
    height: 40px;
    background-color: #ff5000;
    border: none;
    border-radius: 5px;
    color: #fafafa;
    font-size: 14px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
  }
}

@media screen and (max-width: 840px) {
  .form {
    flex-direction: column;
    .form-left-entry {
      width: 100%;
      margin-bottom: 20px;
      .input-box:not(:last-child) {
        margin-bottom: 20px;
      }
    }
    .form-right-entry {
      width: 100%;
    }
  }
}
</style>
